﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ArithCollect;

namespace UnitTestProject1 {
    [TestClass]
    public class ExprsTest1 {
        [TestMethod]
        public void m11() {
            Expr s = "28*5^2-10699+3^9/1811";
            Console.WriteLine("表达式：{0}", s.ToString());
            Console.WriteLine("测试结果:{0}",(double)s);
            Console.WriteLine("正确答案：{0}",28d*(5d*5d)-10699d+(3d*3d*3d*3d*3d*3d*3d*3d*3d)/1811d);
        }
        [TestMethod]
        public void ExprsTest11() {
            Expr s = "2*3-3*4/sin(3.14159)+2";
            Expr s1 = "2 * 3 - 3 * 4 / 3.14159 + 2";
            Expr s2 = "2 * 3 - 3 * 4 / 3.14159";
            Expr s3 = "(2 * 3 - 3) * 4 / 3.14159";
            Expr s4 = "2 * (3 - 3)*   (7-4 / 3.14159)";
            Expr s5 = "sum(28,35,62,77,95.2)";

            Console.WriteLine(s);
            Console.WriteLine(s1);
            Console.WriteLine(s2);
            Console.WriteLine(s3);
            Console.WriteLine(s4);
            Console.WriteLine(s5);
            Console.WriteLine("-----------------------------------------");
            Console.WriteLine("标准答案:{0}", 2 * 3 - 3 * 4d / Math.Sin(3.14159d) + Math.Max(1, 2));
            Console.WriteLine("标准答案:{0}", 2d * 3d - 3d * 4d / 3.14159d + 2d);
            Console.WriteLine("标准答案:{0}", 2d * 3d - 3d * 4d / 3.14159d);
            Console.WriteLine("标准答案:{0}", (2 * 3 - 3) * 4 / 3.14159);
            Console.WriteLine("标准答案:{0}", 2 * (3 - 3) * (7 - 4 / 3.14159));
            Console.WriteLine("标准答案:{0}", 28 + 35 + 62 + 77 + 95.2);
        }
    }
}
